#include "itemselectpage.h"
#include "ui_itemselectpage.h"
#include "QPainter"
#include<QJsonDocument>
#include "group_view.h"
#include "group.h"
#include "battle_view.h"
#include "dialog/myhelper.h"
#include "constant.h"
#include "qtabbar.h"
ItemSelectPage::ItemSelectPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ItemSelectPage)
{
    ui->setupUi(this);
    ui->tabWidget->setCurrentIndex(0);
    initTableView();
    ui->tabWidget->tabBar()->close();
    initMusicInfo();
    Type="压力调节";
    Scene="缓解焦虑";
    MusicType=0;
    Fcode=901;
    icode=0;
    ui->lineEdit_assignment->setText(Type);
    RefreshTable(MusicType);
    connect(this,SIGNAL(command_toClient(int,QJsonObject)),Server::instance(),SLOT(writeMsgToClient(int,QJsonObject)));
    if(Constant::ShowFullScreen)
        this->showFullScreen();
}

ItemSelectPage::~ItemSelectPage()
{
    delete ui;
}
void ItemSelectPage::initMusicInfo()
{
    MusicName1.clear();
    MusicTime1.clear();
    MusicBelong1.clear();
    MusicSinger1.clear();
    MusicName1.append("水音-渔舟唱晚");
    MusicName1.append("水音-昭君怨");
    MusicName1.append("土音-春江花月夜");
    MusicName1.append("土音-空山鸟语");
    MusicName1.append("土音-马兰花开");
    MusicName1.append("土音-鸟投林");
    MusicName1.append("土音-秋湖月夜");
    MusicName1.append("土音-塞上曲");

    MusicTime1.append("00:04:48");
    MusicTime1.append("00:05:58");
    MusicTime1.append("00:09:19");
    MusicTime1.append("00:03:18");
    MusicTime1.append("00:03:16");
    MusicTime1.append("00:04:15");
    MusicTime1.append("00:10:53");
    MusicTime1.append("00:07:47");

    MusicBelong1.append("古筝古琴十大金曲");
    MusicBelong1.append("古筝传奇");
    MusicBelong1.append("古筝传奇");
    MusicBelong1.append("中国二胡十大金曲");
    MusicBelong1.append("古筝传奇");
    MusicBelong1.append("世纪乐典");
    MusicBelong1.append("笛子艺术荟萃");
    MusicBelong1.append("乐府-琵琶");

    MusicSinger1.append("华夏民族乐团");
    MusicSinger1.append("中央民族乐团");
    MusicSinger1.append("中央民族乐团");
    MusicSinger1.append("华夏民族乐团");
    MusicSinger1.append("华夏民族乐团");
    MusicSinger1.append("群星");
    MusicSinger1.append("群星");
    MusicSinger1.append("群星");


    MusicName2.clear();
    MusicTime2.clear();
    MusicBelong2.clear();
    MusicSinger2.clear();
    MusicName2.append("爱的协奏曲");
    MusicName2.append("爱之梦");
    MusicName2.append("贝多芬-月光奏鸣曲");
    MusicName2.append("贝多芬-致爱丽丝");
    MusicName2.append("柴可夫斯基-天鹅湖");
    MusicName2.append("戴亚-三五七");
    MusicName2.append("回家");
    MusicName2.append("蓝色的爱");

    MusicTime2.append("00:03:47");
    MusicTime2.append("00:03:41");
    MusicTime2.append("00:05:16");
    MusicTime2.append("00:03:25");
    MusicTime2.append("00:03:04");
    MusicTime2.append("00:04:45");
    MusicTime2.append("00:04:45");
    MusicTime2.append("00:01:50");

    MusicBelong2.append("Richard Clayderman");
    MusicBelong2.append("史上最优美钢琴小品精华");
    MusicBelong2.append("古典钢琴入门");
    MusicBelong2.append("那片湖");
    MusicBelong2.append("天鹅湖");
    MusicBelong2.append("中国十大笛子名家名曲");
    MusicBelong2.append("金耳朵");
    MusicBelong2.append("Richard Clayderman");

    MusicSinger2.append("Richard Clayderman");
    MusicSinger2.append("Franz Liszt");
    MusicSinger2.append("Noble Music");
    MusicSinger2.append("Ed Tom");
    MusicSinger2.append("Dark Moon");
    MusicSinger2.append("戴亚");
    MusicSinger2.append("Kenny G");
    MusicSinger2.append("Richard Clayderman");


    MusicName3.clear();
    MusicTime3.clear();
    MusicBelong3.clear();
    MusicSinger3.clear();
    MusicName3.append("大刀进行曲");
    MusicName3.append("军队进行曲");
    MusicName3.append("拉德斯基进行曲");
    MusicName3.append("土耳其进行曲");
    MusicName3.append("运动员进行曲");
    MusicName3.append("振奋精神曲目二");
    MusicName3.append("振奋精神曲目三");
    MusicName3.append("振奋精神曲目四");

    MusicTime3.append("00:00:54");
    MusicTime3.append("00:05:05");
    MusicTime3.append("00:02:23");
    MusicTime3.append("00:03:17");
    MusicTime3.append("00:03:30");
    MusicTime3.append("00:07:29");
    MusicTime3.append("00:08:07");
    MusicTime3.append("00:03:06");

    MusicBelong3.append("万众一心");
    MusicBelong3.append("史上最优美钢琴小品精华");
    MusicBelong3.append("不朽的旋律");
    MusicBelong3.append("2012十大发烧唱片");
    MusicBelong3.append("2017广州交响乐团");
    MusicBelong3.append("未知");
    MusicBelong3.append("未知");
    MusicBelong3.append("未知");

    MusicSinger3.append("群星");
    MusicSinger3.append("Franz Schubert");
    MusicSinger3.append("中国国家交响乐团");
    MusicSinger3.append("群星");
    MusicSinger3.append("广州交响乐团");
    MusicSinger3.append("未知");
    MusicSinger3.append("未知");
    MusicSinger3.append("未知");

    MusicName4.clear();
    MusicTime4.clear();
    MusicBelong4.clear();
    MusicSinger4.clear();
    MusicName4.append("阿尔法脑波音乐一");
    MusicName4.append("阿尔法脑波音乐二");
    MusicName4.append("阿尔法脑波音乐三");
    MusicName4.append("阿尔法脑波音乐四");
    MusicName4.append("阿尔法脑波音乐五");


    MusicTime4.append("00:14:55");
    MusicTime4.append("00:14:52");
    MusicTime4.append("00:12:38");
    MusicTime4.append("00:13:53");
    MusicTime4.append("00:13:28");


    MusicBelong4.append("未知");
    MusicBelong4.append("未知");
    MusicBelong4.append("未知");
    MusicBelong4.append("未知");
    MusicBelong4.append("未知");


    MusicSinger4.append("未知");
    MusicSinger4.append("未知");
    MusicSinger4.append("未知");
    MusicSinger4.append("未知");
    MusicSinger4.append("未知");


}
void ItemSelectPage::paintEvent(QPaintEvent *event)
{
    //通过这种方式可以将图片平铺到窗口上
    //使用样式表可以很方便设置界面，而且非常高效，还能让界面和逻辑分离
    //不过在本例中由于是顶层窗口，所以直接设置样式表也不会显示。
    //所以样式表比较适合子窗口来使用。
    QPainter painter(this);
    painter.drawPixmap(rect(),QPixmap(":/images/share/selectmodel_page_bg2.png"),QRect());
//    //ui->lineEdit_assignment->setText(Type+"-"+Scene);
}
void ItemSelectPage::getUserTableInfo(QHashUserTable m_user)
{
    this->m_userTableHash=m_user;
    GroupOrBattle=0;
}
void ItemSelectPage::getUserTableInfoABCD(QHashUserTable m_hashUser_A,QHashUserTable m_hashUser_B,QHashUserTable m_hashUser_C,QHashUserTable m_hashUser_D)
{
    this->m_userTableHash_A=m_hashUser_A;
    this->m_userTableHash_B=m_hashUser_B;
    this->m_userTableHash_C=m_hashUser_C;
    this->m_userTableHash_D=m_hashUser_D;
    GroupOrBattle=1;
}
void ItemSelectPage::initTableView()
{

    //自定义表头操作
    m_pTableHeader = new TableViewHeader(Qt::Horizontal, this);//表头
    m_pTableHeader->setStretchLastSection(true);//表头最后一列填充
    ui->tableView->setHorizontalHeader(m_pTableHeader);//设置表头

    //创建model（目前使用的是标准数据模型，可以自定义数据模型），绑定model
    m_pTableModel = new QStandardItemModel(this);
    ui->tableView->setModel(m_pTableModel);//设置model
    ui->tableView->verticalHeader()->hide();


    //创建表头信息
    QStringList headerList;
    headerList << " " << tr("No.")   << tr("音乐名称")<< tr("音乐家")<< tr("唱片集")<< tr("音乐时长");
    m_pTableModel->setHorizontalHeaderLabels(headerList);


    //单击
    connect(ui->tableView, &QTableView::clicked,
            this, &ItemSelectPage::on_tableViewClick);
    //双击
    connect(ui->tableView, &QTableView::doubleClicked,
            this, &ItemSelectPage::on_tableViewDbClick);

    //标题头排序
    connect(ui->tableView->horizontalHeader(), &QHeaderView::sectionClicked,
            this, &ItemSelectPage::on_tableViewSort);
    //全选
    connect(m_pTableHeader, &TableViewHeader::stateChanged,
            this, &ItemSelectPage::on_tableViewSelectAllCheckBoxClick);

    //设置列宽
    setColumnWidth();

}
/*************************
 * QTableView-单击事件
 * ***********************/
void ItemSelectPage::on_tableViewClick(QModelIndex nIndex)
{
    int nRow = nIndex.row();

    Scene=m_pTableModel->item(nRow, COLUMN_MUSCINAME)->text();
    switch (MusicType) {
    case 0:
        icode=nRow;
        ui->label->setText("项目时长:"+MusicTime1.at(nRow));
        ui->lineEdit_assignment->setText("音乐治疗之五行音乐-"+m_pTableModel->item(nRow, COLUMN_MUSCINAME)->text());
        break;
    case 1:
        icode=nRow+8;
        ui->label->setText("项目时长:"+MusicTime2.at(nRow));
        ui->lineEdit_assignment->setText("音乐治疗之抒情欣赏-"+m_pTableModel->item(nRow, COLUMN_MUSCINAME)->text());

        break;
    case 2:
        icode=nRow+16;
        ui->label->setText("项目时长:"+MusicTime3.at(nRow));
        ui->lineEdit_assignment->setText("音乐治疗之振奋精神-"+m_pTableModel->item(nRow, COLUMN_MUSCINAME)->text());

        break;
    case 3:
        icode=nRow+24;
        ui->label->setText("项目时长:"+MusicTime4.at(nRow));
        ui->lineEdit_assignment->setText("音乐治疗之脑波音乐-"+m_pTableModel->item(nRow, COLUMN_MUSCINAME)->text());

        break;
    default:
        break;
    }

    Qt::CheckState oldState = m_pTableModel->item(nRow, COLUMN_CHECKBOX)->checkState();
    Qt::CheckState newState;

    if(oldState == Qt::Unchecked)
        newState = Qt::Checked;
    else
        newState = Qt::Unchecked;

    int nRowCount = m_pTableModel->rowCount();//当前行数

    for(int i = 0; i < nRowCount; i++)
    {
        m_pTableModel->item(i, COLUMN_CHECKBOX)->setCheckState(Qt::Unchecked);
    }
    m_pTableModel->item(nRow, COLUMN_CHECKBOX)->setCheckState(newState);

}

/*************************
 * QTableView-双击事件
 * ***********************/
void ItemSelectPage::on_tableViewDbClick(QModelIndex nIndex)
{
    int row = nIndex.row();

    qDebug() << "Db Click row:" << row;
}
/*************************
 * QTableView-排序
 * ***********************/
void ItemSelectPage::on_tableViewSort(int nColumn)
{

    //点击表头实现排序
    ui->tableView->horizontalHeader()->setSortIndicatorShown(true);
    ui->tableView->sortByColumn(nColumn,Qt::AscendingOrder);
}
/*************************
 * QTableView-响应表头全选操作
 * ***********************/
void ItemSelectPage::on_tableViewSelectAllCheckBoxClick(Qt::CheckState state)
{
    int nRowCount = m_pTableModel->rowCount();//当前行数

    for(int i = 0; i < nRowCount; i++)
    {
        m_pTableModel->item(i, COLUMN_CHECKBOX)->setCheckState(state);
    }
}

/*************************
 * QTableView-设置列宽
 * ***********************/
void ItemSelectPage::setColumnWidth()
{
    int w=this->frameGeometry().width();
    ui->tableView->setColumnWidth(COLUMN_CHECKBOX,w*0.05);
    ui->tableView->setColumnWidth(COLUMN_NO, w*0.15);
    ui->tableView->setColumnWidth(COLUMN_MUSCINAME, w*0.2);
    ui->tableView->setColumnWidth(COLUMN_MUSCISINGER, w*0.2);
    ui->tableView->setColumnWidth(COLUMN_MUSCIBELONG, w*0.2);
    ui->tableView->setColumnWidth(COLUMN_MUSCITIME, w*0.2);
}

void ItemSelectPage::RefreshTable(int type)
{
    if(m_pTableModel->rowCount() > 0)
    {
        m_pTableModel->removeRows(0, m_pTableModel->rowCount());
    }
    int row = 0;
    switch (type) {
    case 0:
        for(int i=0;i<8;i++)
        {
            m_pTableModel->insertRow(row, QModelIndex());
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_CHECKBOX), "");
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_NO), row+1);
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCINAME), MusicName1.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCIBELONG), MusicBelong1.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCISINGER), MusicSinger1.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCITIME), MusicTime1.at(i));
            // 设置全部列居中显示
            for(int j = COLUMN_CHECKBOX; j <= COLUMN_MUSCITIME; j++)
            {
                m_pTableModel->item(row, j)->setTextAlignment(Qt::AlignCenter);
            }
            row++;
        }
        break;
    case 1:
        for(int i=0;i<8;i++)
        {
            m_pTableModel->insertRow(row, QModelIndex());
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_CHECKBOX), "");
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_NO), row+1);
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCINAME), MusicName2.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCIBELONG), MusicBelong2.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCISINGER), MusicSinger2.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCITIME), MusicTime2.at(i));
            // 设置全部列居中显示
            for(int j = COLUMN_CHECKBOX; j <= COLUMN_MUSCITIME; j++)
            {
                m_pTableModel->item(row, j)->setTextAlignment(Qt::AlignCenter);
            }
            row++;
        }
        break;
    case 2:
        for(int i=0;i<8;i++)
        {
            m_pTableModel->insertRow(row, QModelIndex());
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_CHECKBOX), "");
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_NO), row+1);
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCINAME), MusicName3.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCIBELONG), MusicBelong3.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCISINGER), MusicSinger3.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCITIME), MusicTime3.at(i));
            // 设置全部列居中显示
            for(int j = COLUMN_CHECKBOX; j <= COLUMN_MUSCITIME; j++)
            {
                m_pTableModel->item(row, j)->setTextAlignment(Qt::AlignCenter);
            }
            row++;
        }
        break;
    case 3:
        for(int i=0;i<5;i++)
        {
            m_pTableModel->insertRow(row, QModelIndex());
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_CHECKBOX), "");
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_NO), row+1);
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCINAME), MusicName4.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCIBELONG), MusicBelong4.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCISINGER), MusicSinger4.at(i));
            m_pTableModel->setData(m_pTableModel->index(row, COLUMN_MUSCITIME), MusicTime4.at(i));
            // 设置全部列居中显示
            for(int j = COLUMN_CHECKBOX; j <= COLUMN_MUSCITIME; j++)
            {
                m_pTableModel->item(row, j)->setTextAlignment(Qt::AlignCenter);
            }
            row++;
        }
        break;
    default:
        break;
    }

}
void ItemSelectPage::on_pushButton_exit_clicked()
{
    this->close();
}


void ItemSelectPage::on_pb_PressureRegulation_clicked()
{
    ui->tabWidget->setCurrentIndex(0);
    Type="压力调节";
    Fcode=901;
    icode=0;
    Scene="缓解焦虑";//默认选择第一个
    ui->lineEdit_assignment->setText("压力调节");
    ui->label->setText("项目时长:00:02:54");

}


void ItemSelectPage::on_pb_Music_clicked()
{
    ui->tabWidget->setCurrentIndex(1);
    Type="音乐治疗";
    Fcode=902;
    icode=0;
    Scene="水音-渔舟唱晚";//默认选择第一个
    ui->lineEdit_assignment->setText("音乐治疗");
}


void ItemSelectPage::on_pb_Train_clicked()
{
    ui->tabWidget->setCurrentIndex(2);
    Type="反馈训练";
    Fcode=903;
    icode=0;
    Scene="菩提树";//默认选择第一个
    ui->lineEdit_assignment->setText("反馈训练");
    ui->label->setText("项目时长:00:05:00");
}


void ItemSelectPage::on_pb_SoulHealth_clicked()
{
    ui->tabWidget->setCurrentIndex(3);
    Type="心灵康养";
    Fcode=904;
    icode=0;
    Scene="秋林读书";//默认选择第一个
    ui->lineEdit_assignment->setText("心灵康养");
    ui->label->setText("项目时长:00:05:00");
}


void ItemSelectPage::on_pb_pr_hjjl_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之缓解焦虑");
    Scene="缓解焦虑";
    icode=0;
    ui->label->setText("项目时长:00:02:54");
}


void ItemSelectPage::on_pb_pr_yyly_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之抑郁疗愈");
    Scene="抑郁疗愈";
    icode=1;
    ui->label->setText("项目时长:00:05:00");

}


void ItemSelectPage::on_pb_pr_plhf_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之疲劳恢复");
    Scene="疲劳恢复";
    icode=2;
    ui->label->setText("项目时长:00:05:18");
}


void ItemSelectPage::on_pb_pr_nbsy_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之脑波释压");
    Scene="脑波释压";
    icode=3;
    ui->label->setText("项目时长:00:05:34");
}


void ItemSelectPage::on_pb_pr_xlsh_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之心灵舒缓");
    Scene="心灵舒缓";
    icode=4;
    ui->label->setText("项目时长:00:03:15");
}


void ItemSelectPage::on_pb_pr_zzdx_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之专注当下");
    Scene="专注当下";
    icode=5;
    ui->label->setText("项目时长:00:02:53");
}


void ItemSelectPage::on_pb_pr_sepp_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之双耳拍频");
    Scene="双耳拍频";
    icode=6;
    ui->label->setText("项目时长:00:05:02");
}


void ItemSelectPage::on_pb_pr_stly_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之颂体疗愈");
    Scene="颂体疗愈";
    icode=7;
    ui->label->setText("项目时长:00:04:26");
}


void ItemSelectPage::on_pb_pr_sxfs_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之呼吸放松");
    Scene="身心放松";
    icode=8;
    ui->label->setText("项目时长:00:03:15");
}


void ItemSelectPage::on_pb_pr_mxfs_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之松弛训练");
    Scene="冥想放松";
    icode=9;
    ui->label->setText("项目时长:00:03:30");
}


void ItemSelectPage::on_pb_pr_sdty_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之深度调养");
    Scene="深度调养";
    icode=10;
    ui->label->setText("项目时长:00:04:12");
}


void ItemSelectPage::on_pb_pr_jjrs_clicked()
{
    ui->lineEdit_assignment->setText("压力调节之暗示训练");
    Scene="积极人生";
    icode=11;
    ui->label->setText("项目时长:00:05:16");
}


void ItemSelectPage::on_pb_wuxingMusic_clicked()
{
    MusicType=0;
    ui->lineEdit_assignment->setText("音乐治疗之五行音乐");
    RefreshTable(0);
}


void ItemSelectPage::on_pb_sqxsMusic_clicked()
{
    MusicType=1;
    RefreshTable(1);
    ui->lineEdit_assignment->setText("音乐治疗之抒情欣赏");
}


void ItemSelectPage::on_pb_zfjsMusic_clicked()
{
    MusicType=2;
    RefreshTable(2);
    ui->lineEdit_assignment->setText("音乐治疗之振奋精神");
}


void ItemSelectPage::on_pb_brainwaveMusic_clicked()
{
    MusicType=3;
    RefreshTable(3);
    ui->lineEdit_assignment->setText("音乐治疗之脑波音乐");
}


void ItemSelectPage::on_pb_enter_clicked()
{
    if(ui->lineEdit_assignment->text().length()>0){
        QJsonObject CommandInfo;
        CommandInfo.insert("fcode",Fcode);//功能码（900-测量模式，901，压力调节，902-音乐模式，903-反馈训练，904-心灵康养）
        CommandInfo.insert("icode",icode);//信息码，具体训练项目
        CommandInfo.insert("msg","指令下达");
        QHashUserTableIterator i = m_userTableHash.begin();
        QString times=ui->label->text();
        QString time_sub_hour=times.mid(5,2);
        QString time_sub_m=times.mid(8,2);
        QString time_sub_s=times.mid(11,2);
        int NeedTime=time_sub_hour.toInt()*3600+time_sub_m.toInt()*60+time_sub_s.toInt();
        if(GroupOrBattle==0){
            for(; i != m_userTableHash.end(); ++i)
            {
                USER_TABLE_DATA data = i.value();
                emit command_toClient(data.socketDescriptor,CommandInfo);
            }

            Group_view *group_view=new Group_view;
            connect(this,SIGNAL(SendUserTableInfo(QHashUserTable,QString,QString,QString,int)),group_view,SLOT(getUserTableInfo(QHashUserTable,QString,QString,QString,int)));
            emit SendUserTableInfo(m_userTableHash,ui->lineEdit_assignment->text(),Type,Scene,NeedTime);
            group_view->show();
        }else
        {
            i=m_userTableHash_A.begin();
            for(; i != m_userTableHash_A.end(); ++i)
            {
                USER_TABLE_DATA data = i.value();
                emit command_toClient(data.socketDescriptor,CommandInfo);
            }
            i=m_userTableHash_B.begin();
            for(; i != m_userTableHash_B.end(); ++i)
            {
                USER_TABLE_DATA data = i.value();
                emit command_toClient(data.socketDescriptor,CommandInfo);
            }
            i=m_userTableHash_C.begin();
            for(; i != m_userTableHash_C.end(); ++i)
            {
                USER_TABLE_DATA data = i.value();
                emit command_toClient(data.socketDescriptor,CommandInfo);
            }
            i=m_userTableHash_D.begin();
            for(; i != m_userTableHash_D.end(); ++i)
            {
                USER_TABLE_DATA data = i.value();
                emit command_toClient(data.socketDescriptor,CommandInfo);
            }
            Battle_view *battle_view =new Battle_view;
            connect(this,SIGNAL(SendUserTableInfoABCD(QHashUserTable,QHashUserTable,QHashUserTable,QHashUserTable,QString,QString,QString,int)),battle_view,SLOT(getUserInfo(QHashUserTable,QHashUserTable,QHashUserTable,QHashUserTable,QString,QString,QString,int)));
            emit SendUserTableInfoABCD(m_userTableHash_A,m_userTableHash_B,m_userTableHash_C,m_userTableHash_D,ui->lineEdit_assignment->text(),Type,Scene,NeedTime);
            battle_view->show();
        }
        this->close();
    }else
    {
        myHelper::ShowMessageBoxInfo("请输入任务名称！");
    }
}


void ItemSelectPage::on_pb_hnxq_clicked()
{
    Scene="焕能小憩";
    icode=0;
    ui->lineEdit_assignment->setText("反馈训练之焕能小憩");
}


void ItemSelectPage::on_pb_smxf_clicked()
{
    Scene="焕能修复";
    icode=1;
    ui->lineEdit_assignment->setText("反馈训练之焕能修复");
}


void ItemSelectPage::on_pb_qljs_clicked()
{
    Scene="千里江山";
    icode=0;
    ui->lineEdit_assignment->setText("心灵康养之千里江山");
    ui->label->setText("项目时长:00:05:00");
}


void ItemSelectPage::on_pb_qlds_clicked()
{
    Scene="秋林读书";
    icode=1;
    ui->lineEdit_assignment->setText("心灵康养之秋林读书");
    ui->label->setText("项目时长:00:05:00");
}


void ItemSelectPage::on_pb_pts_clicked()
{
    Scene="菩提树";
    icode=0;
    ui->lineEdit_assignment->setText("反馈训练之菩提树");
}


void ItemSelectPage::on_pb_lhsk_clicked()
{
    Scene="莲花盛开";
    icode=1;
    ui->lineEdit_assignment->setText("反馈训练之莲花盛开");
}



void ItemSelectPage::on_pb_fhjc_clicked()
{
    Scene="繁花锦簇";
    icode=2;
    ui->lineEdit_assignment->setText("反馈训练之繁花锦簇");
}


void ItemSelectPage::on_pb_ffmg_clicked()
{
    Scene="芬芳玫瑰";
    icode=3;
    ui->lineEdit_assignment->setText("反馈训练之芬芳玫瑰");
}

void ItemSelectPage::on_pb_cnhk_clicked()
{
    Scene="春暖花开";
    icode=4;
    ui->lineEdit_assignment->setText("反馈训练之春暖花开");
}


void ItemSelectPage::on_pb_msq_clicked()
{
    Scene="魔术球";
    icode=5;
    ui->lineEdit_assignment->setText("反馈训练之魔术球");
}


void ItemSelectPage::on_pb_hjsy_clicked()
{
    Scene="寒江疏影";
    icode=6;
    ui->lineEdit_assignment->setText("反馈训练之寒江疏影");
}


void ItemSelectPage::on_pb_dzsz_clicked()
{
    Scene="豆子生长";
    icode=7;
    ui->lineEdit_assignment->setText("反馈训练之豆子生长");
}


void ItemSelectPage::on_pb_hjfs_clicked()
{
    Scene="火箭发射";
    icode=8;
    ui->lineEdit_assignment->setText("反馈训练之火箭发射");
}


void ItemSelectPage::on_pb_fyfx_clicked()
{
    Scene="馥郁芬香";
    icode=9;
    ui->lineEdit_assignment->setText("反馈训练之馥郁芬香");
}


void ItemSelectPage::on_pb_xkbh_clicked()
{
    Scene="星空变化";
    icode=10;
    ui->lineEdit_assignment->setText("反馈训练之星空变化");
}


void ItemSelectPage::on_pb_lsjy_clicked()
{
    Scene="绿色家园";
    icode=11;
    ui->lineEdit_assignment->setText("反馈训练之绿色家园");
}




